/*
 * Copyright 2013 JROSE
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jrose.entity.data;

import lombok.Getter;
import lombok.Setter;
import org.jrose.api.annotation.cache.CacheExpiration;
import org.jrose.api.annotation.persistence.Column;
import org.jrose.api.annotation.persistence.Table;
import org.jrose.entity.common.AbstractDatabaseEntity;

/**
 * Attribute data structure.
 *
 * @author Xiaohai Zhang
 * @serial
 * @since 2013-08-30 21:05
 */
@Table("JROSE_ATTRIBUTE")
@CacheExpiration
public class Attribute extends AbstractDatabaseEntity {
    private static final long serialVersionUID = -3350721254894289556L;

    @Getter @Setter @Column(notNull = true) private Long roleId;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer maxHealth;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer health;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer maxMana;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer mana;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer attack;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer defense;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer spiritAttack;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer spiritDefense;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer speed;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("0")) private Integer experience;
    @Getter @Setter @Column(defaultValue = @Column.DefaultValue("1")) private Integer level;

    // static factory methods:

    public static Attribute newInstance(Long roleId) {
        Attribute attribute = new Attribute();
        attribute.setRoleId(roleId);
        return attribute;
    }
}
